﻿/*document.write('<script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script>');*/
var Ucenter = {
    init: function () {
        if ($.browser.msie) Ucenter.Ui.roundCorner($('.pub-tab_head .parent_switcher li'), '<b class="lt"></b><b class="rt"></b>');
        Ucenter.Ui.easyHover($('.pub-tab_content .submenu li'), 'over');
        Ucenter.Ui.easyHover($('.pub-share .icos'), 'ac');
        //        $('.pub-tab_content .submenu li').click(function () {
        //            $('.pub-tab_content .submenu li').removeClass('ac'); $(this).addClass('ac');
        //            var albumID = $(this).attr("albumID");
        //            ShowAlbumInfo(albumID);
        //        });
        //Ucenter.Ui.autoHeight($('.sidebar'), $('.mainbar'));
        ZZ($('.pub-share .zt'));
        function ZZ(ele) {
            ele.unbind('click').click(function () {

                var t = $(this), id = parseInt($.trim(t.attr('id'))), rel = $.trim(t.attr('rel'));
                if (/^[0-9]+$/.test(id) && typeof id === 'number') {
                    var url = 'http://resources.pomoho.com/swf/out_player.swf?flvid=' + id + '&outall=true&domain=video.baomihua.com/' + rel + '&qudao=manage',
                    s1 = 'http://video.baomihua.com/' + rel + '/' + id,
                    s2 = url,
                    s3 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="480" height="396" id="object"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="' + url + '" /><embed src="' + url + '" quality="high" width="480" height="396" allowScriptAccess="always"/></object>',
                    s4 = '[flash]' + url + '[/flash]';
                }
                else { alert('ID值异常！'); return false; }
                Ucenter.Event.popLayer.call(this, [t, 'zhuantie_pop_wrap', '<div class="p-poper p-poper_zz"><div class="top"><a title="点击关闭" class="w_close" href=""><b class="close">关闭</b></a></div><h6>此节目地址（URL）</h6><p><input class="linker" type="text" value="' + s1 + '" /></p><h6>把播放器显示到个人空间或Blog</h6><p><input class="linker" type="text" value="' + s2 + '" /></p><h6>HTML代码，适用于个人空间（或其他类型的Blog）</h6><p><input class="linker" type="text" value="" /></p><h6>BBS代码</h6><p><input class="linker" type="text" value="' + s4 + '" /></p></div>'], { 'options': { 'top': t.offset().top + 25, 'width': 300, 'height': 'auto', 'animate': 1, 'close': true, 'load': 1} });
                var zz = $('.zhuantie_pop_wrap');
                zz.find('.linker').eq(2).attr('value', s3).end().mouseover(function () { $(this).select() }).end().find('.w_close').click(function () { $(this).parents('.zhuantie_pop_wrap').hide(); return false });
                return false;
            });
        }
    },
    init_once: function () {
        Ucenter.Config.public.userGuider();
    },
    Common: {
        addEvent: function (target, eventType, functionRef, capture) {
            if (typeof target.addEventListener != 'undefined') {
                target.addEventListener(eventType, functionRef, capture);
            } else if (typeof target.attachEvent != "undefined") {
                target.attachEvent("on" + eventType, functionRef);
            }
        },
        mouseEvent: function (a, b, c, fun1, fun2) {
            switch (a) {
                case 'hover': b.hover(fun1 || function () { $(this).addClass(c); }, fun2 || function () { $(this).removeClass(c); });
                case 'click': b.click(fun1 || function () { $(this).addClass(c); return false });
            }
        }
    },
    Ui: {
        autoHeight: function (a, b) {
            a.height('auto'); b.height('auto');
            a.height() >= b.height() ? b.height(a.height()) : a.height(b.height());
        },
        easyHover: function (a, b, fun1, fun2) {
            a.hover(fun1 || function () { $(this).addClass(b); }, fun2 || function () { $(this).removeClass(b); });
        },
        alternateRowColors: function (a, b, c, d) {
            for (var i = 0, j = a.length; i < j; i++) {
                a.eq(b).css(d);
                b += c;
                if (b > j) break;
            }
        },
        roundCorner: function (a, b) {
            a.append(b);
        },
        Resize: function (im, nWidth, nHeight) {
            var obj = im || document.getElementById(im);
            var w, h, p1, p2;
            p1 = nWidth / nHeight;
            p2 = obj.width / obj.height;
            w = 0;
            h = 0;
            if (p1 < p2) {
                w = nWidth;
                h = nWidth * (1 / p2);
            } else {
                if (obj.width < nWidth && obj.height < nHeight) {
                    w = obj.width;
                    h = obj.height;
                } else {
                    h = nHeight;
                    w = nHeight * p2;
                }
            }
            obj.style.width = w + 'px';
            obj.style.height = h + 'px';
            obj.style.marginTop = (nHeight - h) / 2 + 'px';
        },
        autoThumb: function (path, w, h) {
            $(path).each(function (i) {
                var preldimg = new Image();
                preldimg.onload = function () {
                    setTimeout(function () {
                        Ucenter.Ui.Resize($(path)[i], w, h);
                        preldimg = null;
                    }, 50);
                }
                preldimg.src = $(path)[i].src;
            });
        },
        charCodeAbout: function (str) {
            var sum = 0;
            for (var i = 0; i < str.length; i++) {
                strCode = str.charCodeAt(i);
                if (strCode <= 126 && strCode >= 32) {
                    sum++;
                }
                else { sum += 2; }
            }
            return sum;
        },
        simulateSelect: function (self, ele) {
            if (!self.find(ele)[0]) { return false; }
            var ele = $(ele);
            var down = false;
            var cur = ele.find('.selected a'), op = cur.parent().siblings('.options');
            ele.find('.selected a').attr('tabindex', '1').click(function () {
                cur.focus().toggleClass('ac').css('width', op.width() - 8);
                op.toggle().mousedown(function () {
                    down = true;
                }).mouseup(function () {
                    down = false; ele.find('.selected').focus();
                }).find('li').unbind('click').click(function () {
                    cur.text($(this).find('a').text());
                    cur.removeClass('ac').css('width', 'auto');
                    op.hide();
                    $('.p-scrollLoad').html('<div class="pub-loading_s1" style="text-align:left;">数据加载中...</div>')
                    var type = $(this).attr('messageType'), obj = {};
                    obj.type = type;
                    Ucenter.Config.public.simulateSelect(function () {
                        Ucenter.init();
                    }, obj)
                    return false;
                });
                return false;
            }).blur(function () {
                if (down) { return false; }
                cur.removeClass('ac').css('width', 'auto');
                op.hide();
            });
        },
        fixedLayer: function (self, obj) {
            var target = $(obj.target), op = obj.option;
            target.css({ 'position': 'fixed', 'left': op.left, 'top': op.top, 'width': op.width, 'height': op.height, 'background': op.background, 'margin': op.margin, 'line-height': op.lineHeight, 'opacity': op.opacity, 'border': op.border, 'zIndex': op.zIndex }).html(obj.option.label);
            if (window.ActiveXObject) {
                target.css({ 'position': 'absolute' });
                pos();
                $(window).scroll(function () {
                    pos();
                }).resize(function () { pos(); });
                function pos() {
                    var top = Math.floor(document.body.scrollTop + document.documentElement.scrollTop + document.documentElement.clientHeight * (parseInt(op.top) / 100)), left = Math.floor(document.body.scrollLeft + document.documentElement.scrollLeft + document.documentElement.clientWidth * (parseInt(op.top) / 100));
                    target.css({ 'top': top, 'left': left });
                }
            }
            return target;
        },
        /*easyPopLayer:function(option){
        var content=$(option.content).appendTo(option.location).css({'left':option.left,'top':option.top,'height':option.height,'width':option.width}),doc=document,docEle=doc.documentElement,
        skins={
        'redShine':'<div class="p-LGBg"><b class="bd nw"></b><b class="bd n"></b><b class="bd ne"></b><b class="bd w"></b><b class="bd e"></b><b class="bd sw"></b><b class="bd s"></b><b class="bd se"></b></div><b class="arr"></b>'
        }
        //docEle.scrollTop=doc.body.scrollTop=0;
        content.append(skins[option.skin]);
        if(option.locker){
        var pageHeight=doc.body.scrollHeight;
        var masker=$('<div class="p-masker"></div>').appendTo('body').css({'width':'100%','height':pageHeight,'background':'#000','opacity':.5});
        $('html').css('overflow','hidden');
        docEle.scrollTop=doc.body.scrollTop=0;
        $('.container').click(function(){return false});
        }
        if(masker&&typeof masker!=='undefined'){
        masker.clear=function(){
        masker.remove();
        $('html').css('overflow-y','auto'); 
        $('.container').unbind('click');
        }
        }
        var button=option.button;
        if(button){
        $(option.button.html).appendTo(content).click(function(){
        button.callback instanceof Function?button.callback(content,masker):null;
        return false;   
        });
        }
        },*/
        cardShow: function (self) {//用户名片
            if (!self.find('.user_bar .avatar a')[0]) { return false; }
            var t = this, userCardArray = new Array(), uidArray = new Array(), userCard = {};
            self.find('.user_bar .avatar a').hover(function () {
                clearTimeout(t.timer);
                var tempArr = $(this).attr('href').toString().split('/');
                var uid = 0;
                if (tempArr != null && tempArr.length > 0) {
                    uid = tempArr[tempArr.length-1].split('_')[0];
                }
                //var uid = $(this).attr('href').toString().split('/')[4].split('&')[0]; //获得当前用户的uid
                //alert(uid);
                if (/^[0-9]{1,}$/i.test(uid)) {
                    if ($.inArray(uid, uidArray) < 0) {
                        var tempVal = PUBAjaxClass.GetUserCardInfo(uid).value;
                        userCard = eval(tempVal)[0];
                        uidArray.push(uid);
                        userCardArray.push(userCard);
                    }
                    else {
                        var index = $.inArray(uid, uidArray);
                        userCard = userCardArray[index];
                    }
                }
                else { alert('非法的ID！'); return false; }
                //数据拼装并调用函数
                var tempHtml = '<div class="poper-usercard" id=\"poper-usercard_' + uid + '\"><div class="userdata"><div class="user_bar"><div class="avatar"><a href="userhome.aspx?uid=' + uid + '" target="_blank" title="' + userCard.name + '">';
                tempHtml += '<img src="' + userCard.avatar + '" alt="' + userCard.name + '" /></a></div></div><div class="userinfo"><ul><li class="name"><a href="userhome.aspx?uid=' + uid + '" target="_blank" title="' + userCard.name + '">';
                tempHtml += userCard.name + '</a></li><li class="domicile"><span class="label">地区：</span>' + userCard.domicile + '</li><li class="riches"><span class="label gz">关注<strong>' + userCard.num[0] + '</strong></span><span class="label fs">粉丝<strong>';
                tempHtml += userCard.num[1] + '</strong></span><span class="label wb">微博<strong>' + userCard.num[2] + '</strong></span></li></ul></div></div>';
                if (curUserID != uid) {
                    tempHtml += ' <div class="controlbar"><span class="opera">';
                    var userAndUser = PUBAjaxClass.GetUserAndUserRelationStr(curUserID, uid).value;
                    //                    if (userAndUser.split('|')[1] == "0") {
                    //                        tempHtml += '<a href="javascript:SubscibeBlog(' + curUserID + ',' + uid + ')">关注</a><span class="g">|</span>';
                    //                    } else {
                    //                        tempHtml += '<a href="javascript:DelSubscibeBlog(' + curUserID + ',' + uid + ')">取消关注</a><span class="g">|</span>';
                    //                    }
                    tempHtml += '<a href="sendmessage.aspx?_recvuserid=' + uid + '">发消息</a><span class="g">|</span>';
                    if (userAndUser.split('|')[0] == "0") {
                        tempHtml += '<a href="javascript:AjaxAddFriend(' + curUserID + ',' + uid + ')">加好友</a></span></div>';
                    } else if (userAndUser.split('|')[0] == "1") {
                        tempHtml += '<a href="javascript:AjaxDelFriend(' + curUserID + ',' + uid + ')">删除好友</a></span></div>';
                    } else {
                        tempHtml += '<a href="javascript:void(0)">等待好友确认</a></span></div>';
                    }
                }
                tempHtml += ' <b class="arr"></b></div>';
                Ucenter.Event.popLayer.call(this, [$('.user_bar .avatar a'), 'card_pop_wrap', tempHtml], { 'options': { 'top': $(this).offset().top - 125, 'left': $(this).offset().left, 'width': 300, 'height': 'auto', 'load': 2} });
                if ($.browser.msie) $('<div class="poper-usercard_bg"></div>').appendTo('.poper-usercard').css({ 'width': $('.poper-usercard').width() + 16, 'height': $('.poper-usercard').height() + 16, 'left': '-8px', 'top': '-8px' });
            }, function () {
                var show = false;
                $('.poper-usercard').mouseover(function () { $(this).show(); show = true; }).mouseout(function () { $(this).hide() });
                t.timer = setTimeout(function () { if (!show) $('.poper-usercard').hide(); }, 250);
            });
        }
    },
    Event: {
        editBox: function (aa) {
            var t1 = $(this), pcl = $('.' + aa[1]), txt = $.trim(t1.text());
            if (txt == '相册描述' || txt == '相册标题' || txt == '') { txt = '' }
            var oldtxt = pcl.val();
            pcl.val(txt).focus().blur(function () {
                var t2 = $('.' + aa[1]); txt = $.trim(t2.val());
                pcl.hide();
                aa[0].removeClass('ac');
                if (txt == '相册描述' || txt == '相册标题' || txt == '') { t1[0].className == 'title' ? txt = '相册标题' : txt = '相册描述' }
                t1.text(txt);
                if (typeof (t1.attr("albumID")) != 'undefined' && txt != oldtxt) {
                    if (t1.attr("class") == "title") {
                        txt = $.trim(txt);
                        if (txt == "" || txt == "相册标题") {
                            art.dialog.alert("相册名不能为空");
                            t2.val(oldtxt);
                        }
                        else if (GetStringLength(txt) > 40) {
                            art.dialog.alert("相册名称最长20个汉字，40个英文字母！");
                            t2.val(oldtxt);
                        } else {
                            managephoto_V2.ModifyAlbumTitle(t1.attr("albumID"), txt);
                            $("#ul_UserAlbumList").html(managephoto_V2.GetUserAlbumList($("#hidUserID").val()).value);
                            $("#ul_UserAlbumList li").attr("class", "");
                            $("#ul_UserAlbumList li[albumID='" + t1.attr("albumID") + "']").attr("class", "ac over");
                            Ucenter.init();
                        }
                    } else {
                        managephoto_V2.ModifyAlbumDesc(t1.attr("albumID"), txt);
                    }
                }
                if (typeof (t1.attr("imgID")) != "undefined" && txt != oldtxt) {
                    managephoto_V2.modifyPhotoInfo(t1.attr("imgID"), txt)
                }
                t2.unbind('blur')
            });
        },
        popLayer: function (aa, ab) {
            var t = $(this), pcl = $('.' + aa[1]), mouseDownOnSelect = false, sum = 0;
            if (aa[0] != null && typeof aa[0] != 'undefined') aa[0].removeClass('ac');
            t.addClass('ac');
            t.css('visibility') == 'hidden' || t.css('display') == 'none' ? null : t.focus();
            switch (ab.options.load) {
                case 1: pcl.remove(); break;
                case 2: pcl.remove(); $(aa[2]).hide().appendTo('body').addClass(aa[1]); pcl = $('.' + aa[1]); break
                default: pcl.hide();
            }
            if (!$('.' + aa[1]).length) {
                $(aa[2]).hide().appendTo('body').addClass(aa[1]);
                pcl = $('.' + aa[1]);
            }
            pcl.css({
                'width': typeof ab.options.width == "string" || ab.options.width > 0 ? ab.options.width : t[0].offsetWidth,
                'height': typeof ab.options.height == "string" || ab.options.height > 0 ? ab.options.height : t[0].offsetHeight,
                'left': ab.options && ab.options.left ? ab.options.left : t.offset().left,
                'top': ab.options && ab.options.top ? ab.options.top : t.offset().top + t[0].offsetHeight
            }).mousedown(function () { mouseDownOnSelect = true; }).mouseup(function () {
                mouseDownOnSelect = false;
                if (ab.options.autoHide) { t.blur() }
                else { t.focus(); }
                ab.options.unlocked ? t.focus() : null;
            }).scroll(function () { mouseDownOnSelect = false; t.focus() });
            function childHeight() {
                if (ab.options.scroll && ab.options.height && ab.options.height > 0) {
                    for (var i = 0, l = pcl.children().length; i < l; i++) {
                        sum = sum + pcl.children().eq(i).height();
                    }
                    if (sum > ab.options.height) { pcl.css({ 'overflow': 'auto', 'height': ab.options.height }); }
                    else { pcl.css({ 'overflow': 'hidden', 'height': 'auto' }); }
                }
            }
            switch (ab.options.animate) {
                case 1: pcl.slideDown('slow', function () { childHeight(); }); t.addClass('ac'); break;
                default: pcl.show();
            }
            /*t.blur(function(){
            setTimeout(function(){
            pcl.hide();aa[0].removeClass('ac');t.unbind('blur');
            },300)
            });*/
            if (ab.options.close) return false;
            t.unbind('blur').blur(function () {
                if (!mouseDownOnSelect) { pcl.hide(); aa[0].removeClass('ac'); }
            });
        },
        keyBoard: {
            UP: 38,
            DOWN: 40,
            DEL: 46,
            TAB: 9,
            RETURN: 13,
            ESC: 27,
            COMMA: 188,
            PAGEUP: 33,
            PAGEDOWN: 34,
            BACKSPACE: 8
        },
        inputText: function (ele, text, oa, ob) {
            if (!ele[0]) { return false; }
            var default_text = '';
            if (typeof text === 'undefined' || text === null) { default_text = ele.val(); }
            else { default_text = text; }
            ele.val(default_text).focus(function () {
                var t = $(this), t_val = $.trim(t.val());
                if (t_val == '' || t_val == default_text) $(this).val('').css(oa[0]);
            }).blur(function () {
                var t = $(this), t_val = $.trim(t.val());
                if (t_val == '' || t_val == default_text) { t.val(default_text).css(ob[0]); }
            });
        },
        shortCutKey: function (a, b, fun) {
            a.unbind($.browser.opera ? 'keypress' : 'keydown').bind($.browser.opera ? 'keypress' : 'keydown', function (event) {
                if (event.ctrlKey || event.shiftKey) {
                    if (event.keyCode == b[1]) {
                        event.preventDefault();
                        if (fun instanceof Function) fun();
                    }
                }
                else {
                    if (!b[0] && event.keyCode == b[1]) {
                        event.preventDefault();
                        if (fun instanceof Function) fun();
                    }
                }
            })
        },
        Scroll: function (a, b, c) {
            var id = 1, lin = a.find('li').length, group = lin % c.groupNo == 0 ? parseInt(lin / c.groupNo) - 1 : parseInt(lin / c.groupNo);
            b.width(lin * c.liWidth);
            if (group == 0) { a.find('.l,.r').hide(); return false; }
            a.find('.l').click(function () {
                if (id >= 2) {
                    b.animate({ left: -(c.width * (id - 2)) }, c.during);
                    if (id == 2) {
                        $(this).hide();
                    } if (id == group + 1) {
                        a.find('.r').show().attr('title', '向右翻');
                    }
                    id--;
                }
                return false;
            }).end().find('.r').show().click(function () {
                if (id <= group) {
                    b.animate({ left: -(c.width * id) }, c.during);
                    if (id == 1) {
                        a.find('.l').show().attr('title', '向左翻');
                    } if (id == group) {
                        $(this).hide();
                    }
                    id++;
                }
                return false;
            });
        },
        lazyLoad: function (a) {
            //$('img.crs').attr('alt','[图片]');
            checkImg();
            $(window).scroll(function () {
                checkImg();
            }).resize(function () {
                checkImg();
            });
            function checkImg() {
                var doc = document.documentElement || document.body, lazyImg = $('img.crs'), pageHeight = doc.clientHeight, pageWidth = doc.clientWidth, disTop = document.documentElement.scrollTop + document.body.scrollTop;
                lazyImg.each(function (i) {
                    var _self = $(this), imgTop = _self.offset().top;
                    if (imgTop >= disTop - a.height && imgTop <= disTop + pageHeight) {
                        _self.attr('src', function () { return this.getAttribute('crs') }).removeClass('crs').load(function () {
                            Ucenter.Ui.Resize(this, 120, 90);
                        });
                    }
                });
            }
        },
        scrollLoad: function (ele, obj) {
            if (!ele[0]) { return false; }
            var location = document.documentElement.scrollTop + document.body.scrollTop, locker = false, count = 1, loadingShow = true, loading = null;
            checkScroll(location);
            $(window).scroll(function () {
                checkScroll(location);
            }).resize(function () {
                checkScroll(location);
            });
            function checkScroll(loc) {
                var doc = document.documentElement || document.body, eleH = ele[0].clientHeight, eleTop = ele.offset().top, pageHeight = doc.clientHeight, disTop = document.documentElement.scrollTop + document.body.scrollTop;
                var eleT = (obj.page === 'bIndex' ? eleH + eleTop - Ucenter.Config.bIndex.scrollLoad.preLoadDis : eleH + eleTop);
                if (disTop + pageHeight >= eleT && disTop >= loc && !locker && count < 10) {
                    locker = true;
                    if (loadingShow) {
                        loading = Ucenter.Ui.fixedLayer(document, { target: $('<div class="pub-loading_s1"></div>').appendTo('body'), option: { 'left': '50%', 'top': '50%', 'width': '200px', 'height': '60px', 'margin': '-30px 0 0 -100px', 'background': '#f0f0f0 url(http://static01.pomoho.com/img/lib/loading_1.gif) no-repeat 30% center', 'lineHeight': '60px', 'opacity': 0.8, 'border': '1px solid #ccc', 'zIndex': '9999', 'label': '数据加载中...'} });
                        loadingShow = false;
                    }
                    else { loading.show(); }
                    setTimeout(function () {
                        Ucenter.Config.public.scrollLoad(function (data, option) {
                            //locker = true;
                            //alert(option)
                            if (option.EOF) { return false; }
                            var rData = $(data).appendTo(ele);
                            loading.fadeOut();
                            Ucenter.init();
                            if (obj.page === 'bTinyblog') { Ucenter.bTinyblog.init(rData); }
                            count = option.maxPage;
                            //disTop=document.documentElement.scrollTop + document.body.scrollTop;
                            disTop = document.documentElement.scrollTop + document.body.scrollTop;
                            if (parseInt(count) === 1) {
                                if (disTop > 200) { disTop -= 200; }
                            }
                            document.documentElement.scrollTop = document.body.scrollTop = disTop;
                            locker = false;
                        }, obj);
                    }, 0)
                }
                location = disTop;
            }
        },
        getCursorPosition: function (textarea) {
            var rangeData = { text: "", start: 0, end: 0 };
            textarea.focus();
            if (textarea.setSelectionRange) {
                rangeData.start = textarea.selectionStart;
                rangeData.end = textarea.selectionEnd;
                rangeData.text = (rangeData.start != rangeData.end) ? textarea.value.substring(rangeData.start, rangeData.end) : "";
            }
            else if (document.selection) {
                var i,
                oS = document.selection.createRange(),
                oR = document.body.createTextRange();
                oR.moveToElementText(textarea);
                rangeData.text = oS.text;
                rangeData.bookmark = oS.getBookmark();
                for (i = 0; oR.compareEndPoints('StartToStart', oS) < 0 && oS.moveStart("character", -1) !== 0; i++) {
                    if (textarea.value.charAt(i) == '\r') {
                        i++;
                    }
                }
                rangeData.start = i;
                rangeData.end = rangeData.text.length + rangeData.start;
            }
            return rangeData;
        },
        setCursorPosition: function (textarea, rangeData) {
            if (!rangeData) {
                alert("获取光标位置失败！")
            }
            if (textarea.setSelectionRange) {
                textarea.focus();
                textarea.setSelectionRange(rangeData.start, rangeData.end);
            }
            else if (textarea.createTextRange) {
                var oR = textarea.createTextRange();
                if (textarea.value.length === rangeData.start) {
                    oR.collapse(false)
                    oR.select();
                }
                else {
                    if (rangeData.bookmark) oR.moveToBookmark(rangeData.bookmark);
                    oR.select();
                }
            }
        },
        setCurrsorPositionEnd: function (textarea) {
            var len = textarea.value.length;
            textarea.focus();
            if (document.selection) {
                var range = textarea.createTextRange();
                range.moveStart('character', len);
                range.collapse(true);
                range.select();
            }
        }
    }
}
Ucenter.bImage = {
    init: function () {
        $('.imglist .vdesc,.cover dd .desc').click(function () {
            Ucenter.Event.popLayer.call(this, [$('.imglist .vdesc,.cover dd .desc'), 'pic_editbox_textarea', '<textarea></textarea>'], { 'options': { 'top': $(this).offset().top} });
            Ucenter.Event.editBox.call(this, [$('.imglist .vdesc,.cover dd .desc'), 'pic_editbox_textarea', '<textarea></textarea>']);
            return false;
        });
        $('.cover dd .title').click(function () {
            Ucenter.Event.popLayer.call(this, [$('.cover dd .title'), 'pic_editbox_input', '<input type="text" />'], { 'options': { 'top': $(this).offset().top} });
            Ucenter.Event.editBox.call(this, [$('.cover dd .title'), 'pic_editbox_input', '<input type="text" />']);
            return false;
        });
        //移动下拉框功能函数参数说明：[事件触发DOM、目标层、目标层数据],{目标层的设置}
        $('.imglist .vopera .move').click(function () {
            var tempHtml = "";
            var albumId = $(this).attr("albumID");
            tempHtml = managephoto_V2.GetUserAlbumSelect(albumId, curUserID).value;
            Ucenter.Event.popLayer.call(this, [$('.imglist .vopera .move'), 'pic_cate_list', tempHtml], { 'options': { 'width': 110, 'height': 136, 'animate': 1, 'scroll': true, 'load': 1, 'autoHide': false} });
            return false;
        });
        $('.imglist .vopera .tougao').click(function () {
            var tempHtml = "";
            tempHtml = managephoto_V2.GetChannelList().value;
            Ucenter.Event.popLayer.call(this, [$('.imglist .vopera .tougao'), 'pic_cate_list', tempHtml], { 'options': { 'width': 110, 'height': 136, 'animate': 1, 'scroll': true, 'load': 1, 'autoHide': false} });
            return false;
        });

        Ucenter.Ui.alternateRowColors($('.pannel_con ul'), 0, 2, { 'background-color': '#fcfcfc' });
        $('.upload_pannel .controlbar .deleteall').click(function () {
            $('.upload_pannel .pannel_con ul').remove();
            $('.upload_pannel .pannel_con').html('<p class="notes">暂时没有任何图片</p>');
            return false;
        });
        $('.upload_pannel .pannel_con .opera .delete').click(function () {
            $(this).parents('ul').remove();
            Ucenter.Ui.alternateRowColors($('.pannel_con ul'), 0, 2, { 'background-color': '#fcfcfc' });
            Ucenter.Ui.alternateRowColors($('.pannel_con ul'), 1, 2, { 'background-color': '#fff' });
            if (!$('.upload_pannel .pannel_con ul').length) { $('.upload_pannel .pannel_con').html('<p class="notes">暂时没有任何图片</p>'); return false; }
            return false;
        });
        Ucenter.Ui.autoThumb('.pub-tab_content .cover dt img,.pub-tab_content .imglist .vimg img,.pub-messbox .message .thumbs img', 120, 90);
        Ucenter.Ui.autoThumb('.add_photo_info .single_photo .vimg img', 90, 90);
        Ucenter.Ui.autoThumb('.bImage .pub-messbox .message .thumbs img', 100, 75);
        Ucenter.Ui.easyHover($('.pic_editbox_input'), '', function () { $(this).attr('title', '请输入此相册的标题'); }, function () { $(this).attr('title', ''); });
        Ucenter.Ui.easyHover($('.cover dd .title'), '', function () { $(this).attr('title', '单击这里输入此图片标题'); }, function () { $(this).attr('title', ''); });
        Ucenter.Ui.easyHover($('.imglist .vdesc,.cover dd .desc'), '', function () { $(this).attr('title', '单击这里输入此图片描述'); }, function () { $(this).attr('title', ''); });
        Ucenter.Ui.easyHover($('pic_editbox_textarea'), '', function () { $(this).attr('title', '请输入此图片的描述'); }, function () { $(this).attr('title', ''); });
    },
	imgError: function(obj){
    obj.onerror=null;  
    obj.src="http://static01.pomoho.com/img/lib/ImageError.jpg";
    Ucenter.Ui.autoThumb(obj, 100, 75);
    $(obj).click(function(){return false;});
    $(obj).parent().click(function(){return false;});
    $(obj).css('cursor','default');
    }
}
Ucenter.bUserPage = {
    init: function () {
        Ucenter.Ui.autoThumb('.pub-messbox .message .thumbs img', 120, 90);
    }
}
Ucenter.bTinygame = {
    init: function () {
        Ucenter.Event.inputText($('#searchInput'), '搜索小游戏', [{ 'color': '#333'}], [{ 'color': '#a5a5a5'}]);
    }
}
Ucenter.bIndex = {
    init: function (self) {
        this.searchInstant();
        Ucenter.Event.inputText($('#searchInput'), null, [{ 'color': '#333'}], [{ 'color': '#a5a5a5'}]);
        Ucenter.Ui.simulateSelect(self, '.p-select_sim');
        this.toggleShow(self, { 'hander': '.vipUsers .toogle_click', 'target': '.vipUsers .usersList', 'rows': Ucenter.Config.bIndex.usersList.userRows });
        //Ucenter.Event.scrollLoad($('.p-scrollLoad'),{'page':'bIndex'});
    },
    init_once: function () {

    },
    searchInstant: function () {
        /*$('#searchInput').bind($.browser.opera ? "keypress" : "keydown", function (event) {
        if (event.keyCode == Ucenter.Event.keyBoard.RETURN) {
        event.preventDefault();
        var t = $(this);
        SearchData();
        return false;
        }
        }).focus(function () {

        }).blur(function () {
        var t = $(this);
        SearchData();
        });*/
        var ele = $('#searchInput');
        Ucenter.Event.shortCutKey(ele, [false, Ucenter.Event.keyBoard.RETURN], function () {
            var val = $.trim($('#searchInput').val());
            Ucenter.Config.public.searchInstant({ 'page': 'bIndex', 'value': val });
        });
        $('.go_search').click(function () { var val = $.trim($('#searchInput').val()); Ucenter.Config.public.searchInstant({ 'page': 'bIndex', 'value': val }); return false; })
    },
    toggleShow: function (self, obj) {
        if (!self.find(obj.target)[0]) { return false; }
        var target = $(obj.target), hander = $(obj.hander), l = target.children().length, height = target.height();
        target.animate({ height: height }, 'slow');
        if (l && l <= Ucenter.Config.bIndex.usersList.rowMaxLength) { hander.css({ 'background': 'none', 'cursor': 'default' }); return false; }
        hander.toggle(function () {
            $(this).addClass('ac');
            target.animate({ height: height * obj.rows }, 'slow');
        }, function () {
            $(this).removeClass('ac');
            target.animate({ height: height }, 'slow');
        });
    }
}
Ucenter.bVideo = {
    init: function () {
        Ucenter.Event.Scroll($('#userList'), $('#userBox'), { 'width': 460, 'during': 500, 'liWidth': 42, 'groupNo': 11 });
        this.searchInstant();
        $('.search_pannel .switcher').click(function () { $('.qanda .view_stack').toggle(500); return false; });
    },
    searchInstant: function () {
        $('#searchInput_keywords,#searchInput_user').bind($.browser.opera ? "keypress" : "keydown", function (event) {
            if (event.keyCode == Ucenter.Event.keyBoard.RETURN) {
                event.preventDefault();
                var t = $(this);
                //调用搜索函数,值t.val();
                return false;
            }
        }).focus(function () {

        }).blur(function () {
            var t = $(this);
            //调用搜索函数,值t.val();
        });
    }
}
Ucenter.bTinyblog = {
    weiBoImgUrl: "",
    weiBoBolgUrl: "",
    weiBoVideoUrl: "",
    hidUserID: $('#hidUserID').val(),
    init: function (self) {
        if (typeof self === 'undefined') { self = $(document); }
        Ucenter.Event.lazyLoad({ 'height': 90 });
        this.popup($('.funbox .upload_video'), 'video_pop_wrap', '<p>输入视频地址<br /><span class="note">目前仅支持爆米花网站内的视频链接<br>您可以直接填写视频播放地址</span></p>');
        this.popup($('.funbox .upload_blog'), 'blog_pop_wrap', '<p>输入博文地址<br /><span class="note">目前仅支持爆米花网站内的博文链接<br>如：http://www.baomihua.com/blog/博文ID</span></p>');
        this.popup($('.funbox .upload_pic'), 'pic_pop_wrap', '<p>输入图片地址<br /><span class="note">目前仅支持爆米花网站内的图片链接<br>如：http://www.baomihua.com/img/图片ID<br>或者您右键单个图片，属性里面的图片地址</span></p>');
        Ucenter.Ui.cardShow(self);
        this.countTxt($('#msgTxt'), $('.action_pannel .countTxt'));
		
        Ucenter.Event.shortCutKey($('#msgTxt'), [true, Ucenter.Event.keyBoard.RETURN], function () {
            if (Ucenter.bTinyblog.checkSubmit($('#msgTxt'), $('.action_pannel .countTxt'))) {
                addWeiBo();
                $('.action_pannel .funbox .insert').find('.del').trigger('click');
            }
        });
        Ucenter.Ui.easyHover($('.talk_pannel ul.message>li'), 'ac');
        this.commentLoad();
        $('.action_pannel input.send_btn').unbind('click').click(function () {
            if (Ucenter.bTinyblog.checkSubmit($('#msgTxt'), $('.action_pannel .countTxt'))) {
                addWeiBo();
                $('.action_pannel .funbox .insert').find('.del').trigger('click');
            }
        });
        this.videoPlay();
        this.deleteMine();

        //Ucenter.Event.setCurrsorPositionEnd($('#msgTxt')[0]);
    },
    init_once: function () {
        this.gotoTop();
    },
    variable: {
        limitedWord: 140,
        cursorPosition: {}
    },
    gotoTop: function () {
        var goTop = null, ele = $('.talk_pannel');
        if (ele.offset()) { var eleOffset = ele.offset(), left = eleOffset.left + ele.width(), top = eleOffset.top; }
        $(window).scroll(function () {
            var st = document.documentElement.scrollTop + document.body.scrollTop
            if (st >= top) {
                if (goTop) { goTop.fadeIn(); }
                else {
                    goTop = $('<div class="p-gotoTop"><a class="btn_goTop" href="" title="返回顶部">返回顶部</a></div>').appendTo('body').css('left', left);
                }
                goTop.click(function () {
                    document.documentElement.scrollTop = document.body.scrollTop = 0;
                    return false;
                });
                if (window.ActiveXObject && !window.XMLHttpRequest) {
                    goTop.css('top', st + document.documentElement.clientHeight - goTop.height());
                }
            }
            else {
                if (goTop) goTop.fadeOut();
            }
        });
    },
    checkUrl: function (type, url) {
        var err = { result: false, message: '', pic: false }
        switch (type) {
            case 0:
                if (/(^(http:\/\/)?(www\.)?(pomoho|baomihua)\.com\/img\/[0-9]{1,}((\/?)|(\?[0-9a-z]{1,})?)$)|(^(http:\/\/)?(www\.)?pomoho\.com\/v2\/ImageShow\.aspx\?id\=[0-9]{1,}$)|(^(http:\/\/)?(www\.)?baomihua\.com\/ImageShow\.aspx\?id\=[0-9]{1,}$)/i.test(url)) {
                    err.result = true;
                }
                else if (/^(http:\/\/)?([\w]+\.)?(pomoho|baomihua)\.com(\/[\w-   \.\/\?%&=]*)?\.(jpg|png|gif)$/i.test(url)) {
                    err.result = true;
                    err.pic = true;
                }
                else {
                    err = { result: false, message: '输入的图片地址格式不正确!' }
                }
                return err;
                break;
            case 1:
                if (/(^(http:\/\/)?home\.pomoho\.com\/[0-9a-z_-]{1,}\/[0-9]{1,}((\/?)|(\?[0-9a-z]{1,})?)$)|(^(http:\/\/)?video\.(pomoho|baomihua)\.com\/[0-9a-z_-]{1,}\/[0-9a-z_-]{1,}((\/?)|(\?[0-9a-z_-]{1,})?)$)/i.test(url)) {
                    err.result = true;
                }
                else {
                    err = { result: false, message: '输入的视频地址格式不正确!' }
                }
                return err;
                break;
            case 2:
                if (/(^(http:\/\/)?home\.pomoho\.com\/[0-9a-z]{1,}\/blogview\/[0-9a-z]{1,}((\/?)|(\?[0-9a-z]{1,})?)$)|(^(http:\/\/)?(www\.)?pomoho\.com\/v2\/blogshow\.aspx\?id\=[0-9]{1,}$)|(^(http:\/\/)?(www\.)?baomihua\.com\/blog\/[0-9]{1,}((\/?)|(\?[0-9a-z]{1,})?)$)/i.test(url)) {
                    err.result = true;
                }
                else {
                    err = { result: false, message: '输入的博客地址格式不正确!' }
                }
                return err;
                break;
        }
    },
    countTxt: function (a, b) {
        var t = this;
        total();
        a.bind(($.browser.msie ? 'propertychange' || 'keyup' : 'input'), function () {
            total();
        });
        function total() {
            var strNo = Ucenter.Ui.charCodeAbout($.trim(a.val()));
            var wordNo = Math.ceil(strNo / 2);
            wordNo <= t.variable.limitedWord ? b.html('请文明发言，还可以输入<em>' + (t.variable.limitedWord - wordNo) + '</em>字') : b.html('超出<em class="error">' + (wordNo - t.variable.limitedWord) + '</em>字');
        }
    },
    checkSubmit: function (a, b) {
        a.focus();
        var strNo = Ucenter.Ui.charCodeAbout($.trim(a.val())), wordNo = Math.ceil(strNo / 2);
        if (wordNo > this.variable.limitedWord) { b.html('超出<em class="error">' + (wordNo - this.variable.limitedWord) + '</em>字').hide().fadeIn(); return false; }
        if (wordNo == 0 || typeof wordNo == 'undefined') { b.html('<span class="error">请输入内容</span>').hide().fadeIn(); return false; }
        //这里放微博发布提交接口
        return true;
    },
    popup: function (a, b, s) {//视频、博文、图片等外链弹出层
        var t = this;
        a.unbind('click').click(function () {
            var _self = $(this), color = _self.css('color');
            if (_self.data('locker')) { return false; }
            $('.poper-link').hide();
            t.variable.cursorPosition = Ucenter.Event.getCursorPosition($('#msgTxt')[0]);
            Ucenter.Event.popLayer.call(this, [a, b, '<div class="poper-link"><a title="关闭" class="close" href="#">关闭</a>' + s + '<p class="former"><input type="text" class="inputTxt" /><input type="submit" value="确定" class="pub-btn btn" title="快捷键 Enter" /></p><p class="error"></p><b class="arr"></b></div>'], { 'options': { 'top': $(this).offset().top + 20, 'left': $(this).offset().left - 60, 'width': 'auto', 'height': 'auto', 'close': true, 'autoHide': true} });
            var layer = $('.' + b), ipt = layer.find('input.inputTxt');
            ipt.focus();
            var i = $('.funbox .insert').index(_self[0]), error = layer.find('.error');
            error.html('');
            layer.find('input.btn').unbind('click').click(function () {
                dealUpload();
                return false;
            });
            Ucenter.Event.shortCutKey(ipt, [false, Ucenter.Event.keyBoard.RETURN], function () {
                dealUpload();
            });
            function dealUpload() {
                var text = $.trim(layer.find('input.inputTxt').val()), err = t.checkUrl(i, text);
                if (!err.result) {
                    error.html(err.message);
                    return false;
                }
                switch (i) {
                    case 0:
                        //这里将url地址解析出图片路径，希望这里能搞个异步的获取图片页的图片信息，也就是图片页面地址放进去后点确定能即时分析出图片地址，如果图片不存在能及时提醒用户
                        $('<img src="' + text + '" alt="" />').appendTo(_self.css('color', '#999').text('图片已提交').append('<b class="del" title="删除">删除</b>')).hide();
                        Ucenter.bTinyblog.weiBoImgUrl = layer.find('input.inputTxt').val();
                        _self.data('locker', true); //图片链接按钮上锁
                        $(_self).find('.del').click(function () {
                            _self.empty().text('图片').css('color', color).data('locker', false);
                            Ucenter.bTinyblog.weiBoImgUrl = "";
                        }); //删除后解锁
                        layer.hide();
                        break;
                    case 1:
                        _self.css('color', '#999').text('视频已提交').append('<b class="del" title="删除">删除</b>').data('locker', true); //视频上传后按钮上锁
                        Ucenter.bTinyblog.weiBoVideoUrl = layer.find('input.inputTxt').val();
                        $(_self).find('.del').click(function () {
                            _self.empty().text('视频').css('color', color).data('locker', false);
                            Ucenter.bTinyblog.weiBoVideoUrl = "";
                        }); //删除后解锁
                        layer.hide();

                        break;
                    case 2:
                        _self.css('color', '#999').text('博文已提交').append('<b class="del" title="删除">删除</b>').data('locker', true); //视频上传后按钮上锁
                        Ucenter.bTinyblog.weiBoBolgUrl = layer.find('input.inputTxt').val();
                        Ucenter.Event.setCursorPosition($('#msgTxt')[0], t.variable.cursorPosition);
                        $(_self).find('.del').click(function () {
                            _self.empty().text('博文').css('color', color).data('locker', false);
                            Ucenter.bTinyblog.weiBoBolgUrl = "";
                        }); //删除后解锁
                        layer.hide();
                        break
                }
            }
            function addCon() {
                layer.hide();
                Ucenter.bTinyblog.weiBoBolgUrl = layer.find('input.inputTxt').val();
                Ucenter.Event.setCursorPosition($('#msgTxt')[0], t.variable.cursorPosition);
                //$('#msgTxt').insertAtCaret($.trim(layer.find('input.inputTxt').val()));
                //t.countTxt($('#msgTxt'), $('.action_pannel .countTxt'));
            }
            layer.find('.close').click(function () {//层的关闭按钮
                layer.hide();
                Ucenter.bTinyblog.weiBoBolgUrl = "";
                return false;
            });
            return false;
        });
    },
    commentLoad: function () {//评论、转发加载
        function checkLogined() {
            var hidUserID = parseInt(Ucenter.bTinyblog.hidUserID);
            if (hidUserID == 0) {
                art.dialog({
                    title: '提示信息',
                    content: '<p>您还未登录，请先登录！</p>',
                    lock: false,
                    fixed: true,
                    resize: false,
                    icon: 'error',
                    skin: 'facebook',
                    width: 200,
                    height: 150,
                    esc: false,
                    time: 2
                });
                return false;
            }
            else { return true; }
        }
        $('.talk_pannel .controlbar .pl').unbind('click').click(function () {//评论
            if (!checkLogined()) { return false; }
            var msgBox = $(this).parents('.msgbox');
            var noteId = $(this).attr("noteId");
            if (msgBox.find('.commentPannel')[0]) {
                msgBox.find('.inputTxt').focus();
                return false;
            }
            msgBox.data('zf', msgBox.find('.inputTxt').val());
            $('.talk_pannel .replylist').remove();
            var commentPannel = $('<div class="replylist commentPannel"></div>').appendTo(msgBox), loading = '<div class="pub-loading_s1">正在加载...</div>';
            $('<div class="top"><a href="" class="w_close" title="点击关闭"><b class="close">关闭</b></a></div><div class="talkbox"><textarea class="inputTxt"></textarea><div class="funbox"><input type="button" class="pub-btn send_btn" tabindex="2" value="评论" /><span class="countTxt">还能输入<em>140</em>字</span></div></div>' + loading).appendTo(commentPannel);
            msgBox.find('.inputTxt').focus();
            if (msgBox.data('pl')) { msgBox.find('.inputTxt').val(msgBox.data('pl')) }
            Ucenter.bTinyblog.countTxt(msgBox.find('.inputTxt'), msgBox.find('.countTxt'));
            Ucenter.Event.shortCutKey(msgBox.find('.inputTxt'), [true, Ucenter.Event.keyBoard.RETURN], function () {
                if (Ucenter.bTinyblog.checkSubmit(msgBox.find('.inputTxt'), msgBox.find('.countTxt'))) {
                    CommentWeiBo(msgBox.find('.inputTxt').val(), curUserID, noteId);
                }
            });
            msgBox.find('.send_btn').click(function () {
                if (Ucenter.bTinyblog.checkSubmit(msgBox.find('.inputTxt'), msgBox.find('.countTxt'))) {
                    CommentWeiBo(msgBox.find('.inputTxt').val(), curUserID, noteId);
                    msgBox.find('.inputTxt').val("");
                }
            });
            //下面这段代码通过ajax加载，数据加载完成后才执行msgBox.find('.pub-loading_s1').hide();也就是数据加载w完成后取消正在加载的字样//注意！
            msgBox.find('.pub-loading_s1').hide(); //隐藏加载中字样
            //数据加载后插入到层中
            var tempHtml = PUBAjaxClass.GetCommnetList(noteId, 1).value;
            $('<div class="cont" id="comment_' + noteId + '">' + tempHtml + '</div>').appendTo(commentPannel);
            //$('<div class="cont"><div class="comment"><ul><li><span class="username"><a href="">张三：</a></span><p class="msgcon">OK</p><span class="notes">57分钟前 来自网页</span></li><li><span class="username"><a href="">张三：</a></span><p class="msgcon">OK</p><span class="notes">57分钟前 来自网页</span></li></ul></div><div class="more"><b>1</b><a href="">2</a><a href="">3</a><span>...</span><a href="">下一页</a></div></div>').appendTo(commentPannel);
            msgBox.find('.w_close').click(function () { msgBox.data('pl', msgBox.find('.inputTxt').val()); commentPannel.remove(); $('.talk_pannel ul.message>li').removeClass('ac'); return false; });
            return false;
        });
        $('.talk_pannel .controlbar .zf').unbind('click').click(function () {//转发
            if (!checkLogined()) { return false; }
            var msgBox = $(this).parents('.msgbox');
            var noteId = $(this).attr("noteId");
            if (msgBox.find('.transmitPannel')[0]) {
                msgBox.find('.inputTxt').focus();
                return false;
            }
            msgBox.data('pl', msgBox.find('.inputTxt').val());
            $('.talk_pannel .replylist').remove();
            var commentPannel = $('<div class="replylist transmitPannel"></div>').appendTo(msgBox), loading = '<div class="pub-loading_s1">正在加载...</div>';
            $('<div class="top"><a href="" class="w_close" title="点击关闭"><b class="close">关闭</b></a></div><div class="talkbox"><textarea class="inputTxt"></textarea><div class="funbox"><input type="button" class="pub-btn send_btn" tabindex="2" value="转发" /><span class="countTxt">还能输入<em>140</em>字</span></div></div>' + loading).appendTo(commentPannel);
            msgBox.find('.inputTxt').focus();
            if (msgBox.data('zf')) { msgBox.find('.inputTxt').val(msgBox.data('zf')) }
            Ucenter.bTinyblog.countTxt(msgBox.find('.inputTxt'), msgBox.find('.countTxt'));
            Ucenter.Event.shortCutKey(msgBox.find('.inputTxt'), [true, Ucenter.Event.keyBoard.RETURN], function () {
                if (Ucenter.bTinyblog.checkSubmit(msgBox.find('.inputTxt'), msgBox.find('.countTxt'))) {
                    RelayUserWeiBo(msgBox.find('.inputTxt').val(), curUserID, noteId);
                }
            });
            msgBox.find('.send_btn').click(function () {
                if (Ucenter.bTinyblog.checkSubmit(msgBox.find('.inputTxt'), msgBox.find('.countTxt'))) {
                    RelayUserWeiBo(msgBox.find('.inputTxt').val(), curUserID, noteId);
                }
            });
            //下面这段代码通过ajax加载，数据加载完成后才执行msgBox.find('.pub-loading_s1').hide();也就是数据加载w完成后取消正在加载的字样//注意！
            msgBox.find('.pub-loading_s1').hide();
            var tempHtml = PUBAjaxClass.GetReplyList(noteId, 1).value;
            $('<div class="cont" id="Reply_' + noteId + '">' + tempHtml + '</div>').appendTo(commentPannel);
            //数据加载后插入到层中
            //$('<div class="cont"><div class="comment"><ul><li><span class="username"><a href="">李四：</a></span><p class="msgcon">OK</p><span class="notes">57分钟前 来自网页</span></li><li><span class="username"><a href="">李四：</a></span><p class="msgcon">OK</p><span class="notes">57分钟前 来自网页</span></li></ul></div><div class="more"><b>1</b><a href="">2</a><a href="">3</a><span>...</span><a href="">下一页</a></div></div>').appendTo(commentPannel);
            msgBox.find('.w_close').click(function () { msgBox.data('zf', msgBox.find('.inputTxt').val()); commentPannel.remove(); $('.talk_pannel ul.message>li').removeClass('ac'); return false; });
            return false;
        });
    },
    videoPlay: function () {//插入视频播放器
        $('.videobox .vThumbsBox').unbind('click').click(function () {
            var t = $(this), videoBox = t.parents('.videobox'), playurl = "http://resources.pomoho.com/swf/out_player.swf?playurl=" + videoBox.attr('playurl');
            if (t.attr("type") == "M") {
                t.hide();
                videoBox.siblings('.picbox').hide().end().addClass('vPlay').find('.vTools').show().find('.vClose').click(function () {
                    t.show();
                    videoBox.siblings('.picbox').show().end().removeClass('vPlay').find('.vTools').hide().end().find('.vBox').remove();
                    return false;
                });
                $('<div class="vBox loading"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://resources.pomoho.com/swf/out_player.swf?playurl=" width="550" height="476" id="object"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="' + playurl + '" /><embed src="' + playurl + '" quality="high" width="500" height="486" allowScriptAccess="always"/></object></div>').appendTo(videoBox.find('.vWrap'));
                return false;
            }
        });
    },
    deleteMine: function () {//删除自己的微博
        $('.talk_pannel .controlbar .delete').unbind('click').click(function () {
            var uid = $(this).attr("uid"); //获取当前用户id
            var nid = $(this).attr("nid");
            if (/^[0-9]{1,}$/i.test(uid)) {
                $(this).parents('li').fadeOut();
                //这里写删除的接口 当前ID为uid
                delWeiBo(uid, nid);
            }
            else { alert('非法的ID！'); }
            return false;
        });
    }
}
Ucenter.bBlog = {
    init: function (self) {
        Ucenter.init(self);
    }
}
Ucenter.bMessage = {
    init: function () {

    }
}
Ucenter.bGroup = {
    init: function (self) {
        if (!/bTinyblog/.test(document.body.className)) Ucenter.Ui.cardShow(self);
    }
}
$(function () {
    Ucenter.init();
    Ucenter.init_once();
    var dc = document.body.className.split(' '), l = dc.length, re = false;
    for (var i = 0; i < l; i++) {
        if (/^bIndex|bVideo|bImage|bBlog|bTinyblog|bUserPage|bTinygame|bMessage|bGroup$/i.test(dc[i])) { Ucenter[dc[i]].init($(document)); }
        if (/^bIndex|bTinyblog$/.test(dc[i])) { Ucenter[dc[i]].init_once(); }
        if (/^bTinyblog$/.test(dc[i])) {
            Ucenter.Event.scrollLoad($('.p-scrollLoad'), { 'page': 'bTinyblog' });
            re = true;
        }
    }
    if (!re) {
        for (var i = 0; i < l; i++) {
            if (/^bIndex|bBlog|bImage|bFriends|bUserPage$/.test(dc[i])) {
                Ucenter.Event.scrollLoad($('.p-scrollLoad'), { 'page': dc[i] });
            }
        }
    }
});
(function ($) {//插件库
    $.fn.extend({
        insertAtCaret: function (myValue) {
            var $t = $(this)[0];
            if (document.selection) {
                this.focus();
                sel = document.selection.createRange();
                sel.text = myValue;
                this.focus();
            }
            else
                if ($t.selectionStart || $t.selectionStart == '0') {
                    var startPos = $t.selectionStart;
                    var endPos = $t.selectionEnd;
                    var scrollTop = $t.scrollTop;
                    $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
                    this.focus();
                    $t.selectionStart = startPos + myValue.length;
                    $t.selectionEnd = startPos + myValue.length;
                    $t.scrollTop = scrollTop;
                }
                else {
                    this.value += myValue;
                    this.focus();
                }
        }
    })
})(jQuery);
(function (c, b) { if (typeof a == "undefined" && !a) { var a = c.guiderSys = function (n) { var x = b, i = x.documentElement, t = $(n.refer), e = t.offset(), h = e ? e.left + t[0].offsetWidth : 0, p = e ? e.top + t[0].offsetHeight : 0, s = parseInt(n.left) ? parseInt(n.left) : 0, v = parseInt(n.top) ? parseInt(n.top) : 0, r = $(n.content).appendTo(x.body).css({ left: h + s, top: p + v, height: n.height, width: n.width }), u = $('<span class="close">×</span>').appendTo(r), l = $("html"), o = $("body").children().not(r), w = { redShine: '<div class="p-LGBg"><b class="bd nw"></b><b class="bd n"></b><b class="bd ne"></b><b class="bd w"></b><b class="bd e"></b><b class="bd sw"></b><b class="bd s"></b><b class="bd se"></b></div><b class="arr"></b>' }, q = n.locker; r.append(w[n.skin]); r.clear = function () { r.remove() }; r.veil = function () { r.hide() }; if (q) { var k = i.scrollHeight, j = q.background || "black", g = q.opacity || 1, d = q.scrollbar, m = $('<div class="p-masker"></div>').appendTo("body").css({ width: "100%", height: k, background: j, opacity: g }); if (d == false) { l.addClass("no-scrollbar") } o.click(function () { return false }) } if (m && typeof m !== "undefined") { m.clear = function () { m.remove(); l.removeClass("no-scrollbar"); o.unbind("click") }; m.veil = function () { m.hide(); l.removeClass("no-scrollbar"); o.unbind("click") }; u.click(function () { m.clear() }) } u.click(function () { r.clear() }); var f = n.button; if (f) { $(n.button.html).appendTo(r).click(function () { f.callback instanceof Function ? f.callback(r, m) : null; return false }) } }; a.addCss = function (d) { var g = b, e = g.createElement("style"); e.type = "text/css", d = d.join(""); if (g.createStyleSheet) { e = g.createStyleSheet(); e.cssText = d } else { var f = g.createTextNode(d); e.appendChild(f); g.getElementsByTagName("head")[0].appendChild(e) } }; a.addCss(["html.no-scrollbar{overflow-y:hidden;}", ".p-LG .close{width:20px;height:20px;border:1px solid #999;display:block;position:absolute;top:10px;right:10px;text-align:center;font:bold 16px/20px \\5B8B\\4F53;color:#666;background:#fff;cursor:pointer;}"]) } })(this, this.document);
Ucenter.Config = {//用户中心配置
    public: {
        userGuider: function () {
            if (typeof (userGrade) != 'undefined') {
                switch (userGrade) {
                    case 1:
                        Ucenter.Config.public.setup1();
                        break;
                    case 2:
                        Ucenter.Config.public.setup2();
                        break;
                    case 3:
                        Ucenter.Config.public.setup3();
                        break;
                }
                var bodyClass = $("body").attr("class");
                switch (bodyClass) {
                    case "bVideo":
                        Ucenter.Config.public.setup10();
                        break;
                    case "bImage":
                        Ucenter.Config.public.setup7();
                        break;
                    case "bBlog":
                        Ucenter.Config.public.setup8();
                        break;
                    case "bTinyblog":
                        Ucenter.Config.public.setup9();
                        break;
                }
            }

        },
        setup1: function () {
            var myArray = new Array();
            myArray[0] = "人家只是求关注嘛，点下关注又不会怀孕";
            myArray[1] = "工作忙碌，加班无度，幸好我还可以微博打发会议时间";
            myArray[2] = "你总得习惯身边有些人在关注着你飞得高不高的时候，不是想为你叫好，而是等着看你摔到地上以后到底有多惨";
            myArray[3] = "一想到2012就要来了，一想到我还欠银行的钱，我连做梦都能笑醒！";
            myArray[4] = "跌倒了站起来，换个好看的姿势再倒下去,老是在那跌倒，我怀疑那有个坑";
            myArray[5] = "世界上每天都有比你牛逼或者比你悲惨的人死去，而你还活着，你得这么想";
            myArray[6] = "上课盼下课，上学盼放假,上班盼下班，原来我的目标一直很执着";
            myArray[7] = "低着头一直走，自以为很帅，可是背驼了";
            myArray[8] = "我哪有空跟你玩儿啊，像我这样的大牌，今年档期早都排满了，我有好多好多电影、电视剧、广告要……看啊…";
            myArray[9] = "每次老师说：“请把和考试无关的东西放到讲台上。”我就很想把自己放到讲台上";
            myArray[10] = "空欢喜就是早上醒来，以为自己长高了，仔细一看，原来是被子盖横了";
            myArray[11] = "发怒一分钟便失去60秒的幸福!";
            myArray[12] = "你以为我会眼睁睁地看着你去送死吗？我会闭上眼睛的！";
            myArray[13] = "如果下雪不打伞，我们是不是就可以走到白头了?";
            myArray[14] = "不要同一个傻瓜争辩，否则别人会搞不清到底谁是傻瓜。";
            myArray[15] = "所谓大难不死就是有了灾祸之后得到的不是同情而是莫名其妙的祝贺";
            myArray[16] = "做生意的过程就是一个不断怂恿别人放松警惕，而自己保持高度警惕的过程";

            var displayContent = myArray[parseInt(16 * Math.random())];
            guiderSys({
                content: '<div class="p-LG step1"><div class="pannel"><h2>亲爱的米花您好，</h2><div class="con"><p class="line">彪悍的人生，需要高调，告诉大家您来了</p><p class="line"><textarea class="tblog" onfocus="this.innerHTML=\'\';this.style.color=\'#333\'">' + displayContent + '</textarea></p><p class="line">爆米花网为您准备了一份礼物：<span class="num s30">+500</span> 花红！请领取！</p></div></div></div>',
                refer: '#cuser_left_menu .helper',
                left: 28,
                top: -20,
                skin: 'redShine', //皮肤
                locker: {
                    background: 'black',
                    opacity: .5,
                    scrollbar: false
                },
                button: {
                    html: '<a class="getit" href="#" title="确认领取"><span></span></a>',
                    callback: function (content, masker) {
                        var huahong = parseInt($('#myhuahong').html());
                        huahong += 500;
                        $("#myhuahong").html(huahong);
                        var weiboContent = $(".tblog").val();
                        content.clear();
                        masker.clear();
                        Ucenter.Config.public.setup2();
                        PUBAjaxClass.addWeiBoByGuide(curUserID, weiboContent);
                    }
                }
            });
        },
        setup2: function () {
            var userList = PUBAjaxClass.GetWeiBoLiveUser(curUserID).value;

            guiderSys({
                content: '<div class="p-LG step2" style="height:400px"><div class="pannel"><div class="con"><p class="line s14">恭喜您，微博发送成功且已有人关注您，并且获得了500花红</p> <hr /><p class="line">关注用户将是增加您收入的重要途径之一，关注他们，您将获得更多展现的机会！</p><div class="lists userLists">' + userList + '</div><p class="line s14">关注全部用户，即可<span class="num s30">+500</span>花红！请领取！</p></div></div></div>',
                refer: '#cuser_left_menu .helper',
                left: 28,
                top: -20,
                skin: 'redShine', //皮肤
                locker: {
                    background: 'black',
                    opacity: .5,
                    scrollbar: false
                },
                button: {
                    html: '<a class="getit" href="#" title="关注全部"><span></span></a>',
                    callback: function (content, masker) {
                        content.clear();
                        var huahong = parseInt($('#myhuahong').html());
                        huahong += 500;
                        $("#myhuahong").html(huahong);
                        masker.clear();

                        Ucenter.Config.public.setup3();
                        PUBAjaxClass.SubscibeBlogByGuide(curUserID);
                    }
                }
            });
        },
        setup3: function () {
            var videoList = PUBAjaxClass.GetLiveVideo(curUserID).value;
            guiderSys({
                content: '<div class="p-LG step3" style="height:450px"><div class="pannel"><div class="con"><p class="line s14">关注成功并且获得500花红</p><hr /><p class="line">转载视频是您增加收入最快速，最有效的途径之一，转载完成后记得<span class="num s10">明天来查收入</span>哦！</p><div class="lists ptLists">' + videoList + '</div><p class="line">转载全部视频，即可获得<span class="num s30">+500</span>花红奖励</p></div></div></div>',
                refer: '#cuser_left_menu .helper',
                left: 28,
                top: -20,
                skin: 'redShine', //皮肤
                locker: {
                    background: 'black',
                    opacity: .5,
                    scrollbar: false
                },
                button: {
                    html: '<a class="getit" href="#" title="转载全部"><span></span></a>',
                    callback: function (content, masker) {
                        content.clear();
                        var huahong = parseInt($('#myhuahong').html());
                        huahong += 500;
                        $("#myhuahong").html(huahong);
                        masker.clear();
                        PUBAjaxClass.linkAllVideo(curUserID);
                    }
                }
            });
        },
        setup4: function () {
            var taskList = PUBAjaxClass.GetAllNewTaskList().value;
            guiderSys({
                content: '<div class="p-LG step4" style="height:400px"><div class="pannel"><div class="con"><p class="line s14">花红是爆米花网推出的虚拟货币，花红可以兑换奖品哦！</p><hr /><p class="line">今日热门兑换</p><div class="lists ptLists"><ul><li class="pic"><a href="http://29293.baomihua.com/prize/466" target="_blank"><img src="http://29293.baomihua.com/videogameupload/5a503eb0-c6c8-4ed4-a031-012ab546ba89.jpg" alt="杰克丹尼之铜标签打火机" /></a></li><li class="txt"><a href="http://29293.baomihua.com/prize/466" target="_blank">杰克丹尼之铜标签打火机</a></li><li class="txt"><span class="cost">3,830,000</span></li></ul><ul><li class="pic"><a href="http://29293.baomihua.com/prize/482" target="_blank"><img src="http://29293.baomihua.com/videogameupload/12cef53b-1cbe-488c-b5b7-d81c433589da.jpg" alt="925银镶蓝水晶耳环" /></a></li><li class="txt"><a href="http://29293.baomihua.com/prize/482" target="_blank">925银镶蓝水晶耳环</a></li><li class="txt"><span class="cost">2,646,000</span></li></ul><ul><li class="pic"><a href="http://29293.baomihua.com/prize/460" target="_blank"><img src="http://29293.baomihua.com/videogameupload/1d9b8b69-5a64-4437-8d7e-0b0ed5c0e955.jpg" alt="御藤席三件套" /></a></li><li class="txt"><a href="http://29293.baomihua.com/prize/460" target="_blank">御藤席三件套</a></li><li class="txt"><span class="cost">1,686,000</span></li></ul><ul><li class="pic"><a href="http://29293.baomihua.com/prize/260" target="_blank"><img src="http://29293.baomihua.com/videogameupload/7e68f318-3d55-4d9e-b828-23ac2bf452cc.jpg" alt="欧莱雅水清新洁面露" /></a></li><li class="txt"><a href="http://29293.baomihua.com/prize/260" target="_blank">欧莱雅水清新洁面露</a></li><li class="txt"><span class="cost">2,475,000</span></li></ul><ul><li class="pic"><a href="http://29293.baomihua.com/prize/328" target="_blank"><img src="http://29293.baomihua.com/videogameupload/0ca387e7-9a6d-4956-beca-a162b1a2a6fb.jpg" alt="多功能折叠式电脑桌" /></a></li><li class="txt"><a href="http://29293.baomihua.com/prize/328" target="_blank">多功能折叠式电脑桌</a></li><li class="txt"><span class="cost">1,398,000</span></li></ul></div><p class="line s14">如何赚取更多花红？</p><div class="lists taskLists"><ul>' + taskList + '</ul></div></div></div></div>',
                refer: '#cuser_left_menu .helper',
                left: 28,
                top: -20,
                skin: 'redShine', //皮肤
                locker: {
                    background: 'black',
                    opacity: .5,
                    scrollbar: false
                },
                button: {
                    html: '<label class="getit" href="" title="我知道了"><span ><input  class="known" /></span></label>',
                    callback: function (content, masker) {
                        content.clear();
                        PUBAjaxClass.ModifyUserGuide(curUserID, 5);
                        masker.clear();
                    }
                }
            });
        },
        setup5: function () {
            guiderSys({
                content: '<div class="p-LG step5" style="height:500px"><div class="pannel"><div class="con"><p class="line s14">玉米是可以提现的货币，1玉米=1元人民币，玉米是隔天计算的，记得每天来查哦</p><hr /><p class="line intro"></p><p class="line s14">结算规则</p><p class="line">1）观看是指有效播放，同一天内，每个IP观看一个视频，计该视频有效播放次数1次，不重复计数。<br />2）玉米数 = (有效播放次数/1000)×千次播放单价。千次播放单价是由爆米花网官方定期发布的。<br />3）累计收入达到100元的方可结算，不足100元累计到下个月直到满足兑换条件为止。<br />4）收入每月12日结算，隔月支付（如8月12日支付6月的收入）。<br />5）1个玉米=1元人民币。</p></div></div></div>',
                refer: '#cuser_left_menu .helper',
                left: 28,
                top: -20,
                skin: 'redShine', //皮肤
                locker: {
                    background: 'black',
                    opacity: .5,
                    scrollbar: false
                },
                button: {
                    html: '<label class="getit" href="" title="我知道了" ><span ><input  class="known" /></span></label>',
                    callback: function (content, masker) {
                        PUBAjaxClass.ModifyUserGuide(curUserID, 6);
                        content.clear();
                        masker.clear();
                        //Ucenter.Config.public.setup6();
                    }
                }
            });
        },
        setup6: function () {
            var tasklist = PUBAjaxClass.GetNotCompleteTask(curUserID).value;
            if (tasklist != "2") {
                guiderSys({
                    content: '<div class="p-LG step6"><div class="pannel"><div class="con">' + tasklist + '</div></div></div>',
                    refer: '#cuser_left_menu .helper',
                    left: 28,
                    top: -20,
                    skin: 'redShine', //皮肤
                    locker: {
                        background: 'black',
                        opacity: .5,
                        scrollbar: false
                    },
                    button: {
                        html: '<a class="getit" href="" title="马上去做"><span></span></a>',
                        callback: function (content, masker) {
                            var taskUrl = $("#hid_task").val();
                            content.clear();
                            masker.clear();
                            //PUBAjaxClass.ModifyUserGuide(curUserID, 7);
                            window.location.href = "tasklist.aspx" + taskUrl + "&f=guide";
                        }
                    }
                });
            }
        },
        setup7: function () {
            //图片用户连接绑定引导
            var isTip = PUBAjaxClass.isNoticeUserBind(curUserID,"image").value;
            if (isTip) {
                guiderSys({
                    content: '<div class="p-LG step6" style="height:300px"><div class="pannel"><div class="con"><p class="line s14">您好，目前您还没有绑定同步功能。是否马上绑定？<a href="sinaappset.aspx?f=imageGuide">马上绑定</a></p><hr /><p class="line intro"></p><p class="line s14">绑定同步功能后，您会拥有以下特权：</p><p class="line">1、在爆米花网上传图片会及时同步到您绑定的网站。<br />2、系统每天自动将精彩图片同步到您绑定的网站。<br />3、 同步出去的图片被网友浏览，会增加您的玉米收入。</p></div></div></div>',
                    refer: '#cuser_left_menu .helper',
                    left: 28,
                    top: -20,
                    skin: 'redShine', //皮肤
                    locker: {
                        background: 'black',
                        opacity: .5,
                        scrollbar: false
                    },
                    button: {
                        html: '<a class="getit" href="" title="去看一看"><span></span></a>',
                        callback: function (content, masker) {
                            content.clear();
                            masker.clear();
                            window.location.href = "sinaappset.aspx?f=imageGuide";
                        }
                    }
                });
            }
        },
        setup8: function () {
            //博文用户连接绑定引导
            var isTip = PUBAjaxClass.isNoticeUserBind(curUserID,"blog").value;
            if (isTip) {
                guiderSys({
                    content: '<div class="p-LG step6" style="height:300px"><div class="pannel"><div class="con"><p class="line s14">您好，目前您还没有绑定同步功能。是否马上绑定？<a href="txweiboset.aspx?f=blogGuide">马上绑定</a></p><hr /><p class="line intro"></p><p class="line s14">绑定同步功能后，您会拥有以下特权：</p><p class="line">1、在爆米花网发表博文会及时同步到您绑定的网站。<br />2、系统每天自动将精彩博文同步到您绑定的网站。<br />3、 同步出去的博文被网友浏览，会增加您的玉米收入。</p></div></div></div>',
                    refer: '#cuser_left_menu .helper',
                    left: 28,
                    top: -20,
                    skin: 'redShine', //皮肤
                    locker: {
                        background: 'black',
                        opacity: .5,
                        scrollbar: false
                    },
                    button: {
                        html: '<a class="getit" href="" title="去看一看"><span></span></a>',
                        callback: function (content, masker) {
                            content.clear();
                            masker.clear();
                            window.location.href = "txweiboset.aspx?f=blogGuide";
                        }
                    }
                });
            }
        },
        setup9: function () {
            //微博用户连接绑定引导
            var isTip = PUBAjaxClass.isNoticeUserBind(curUserID,"weibo").value;
            if (isTip) {
                guiderSys({
                    content: '<div class="p-LG step6" style="height:300px"><div class="pannel"><div class="con"><p class="line s14">您好，目前您还没有绑定同步功能。是否马上绑定？<a href="txweiboset.aspx?f=weiboGuide">马上绑定</a></p><hr /><p class="line intro"></p><p class="line s14">绑定同步功能后，您会拥有以下特权：</p><p class="line">1、在爆米花网发表微博会及时同步到您绑定的微博中。<br />2、发表带图片、视频、博文的微博同样可以赚玉米。<br />3、爆米花网手机客户端(iPhone、Android)发布微博一样可以同步。</p></div></div></div>',
                    refer: '#cuser_left_menu .helper',
                    left: 28,
                    top: -20,
                    skin: 'redShine', //皮肤
                    locker: {
                        background: 'black',
                        opacity: .5,
                        scrollbar: false
                    },
                    button: {
                        html: '<a class="getit" href="" title="去看一看"><span></span></a>',
                        callback: function (content, masker) {
                            content.clear();
                            masker.clear();
                            window.location.href = "txweiboset.aspx?f=weiboGuide";
                        }
                    }
                });
            }
        },
        setup10: function () {
            //视频用户连接绑定引导
            var isTip = PUBAjaxClass.isNoticeUserBind(curUserID,"video").value;
            if (isTip) {
                guiderSys({
                    content: '<div class="p-LG step6" style="height:300px"><div class="pannel"><div class="con"><p class="line s14">您好，目前您还没有绑定同步功能。是否马上绑定？<a href="qqappset.aspx?f=videoGuide">马上绑定</a></p><hr /><p class="line intro"></p><p class="line s14">绑定同步功能后，您会拥有以下特权：</p><p class="line">1、在爆米花网上传、转载、转帖视频会及时同步到您绑定的网站。<br />2、系统每天自动将精彩视频同步到您绑定的网站。<br />3、 同步出去的视频被网友浏览，会增加您的玉米收入。</p></div></div></div>',
                    refer: '#cuser_left_menu .helper',
                    left: 28,
                    top: -20,
                    skin: 'redShine', //皮肤
                    locker: {
                        background: 'black',
                        opacity: .5,
                        scrollbar: false
                    },
                    button: {
                        html: '<a class="getit" href="" title="去看一看"><span></span></a>',
                        callback: function (content, masker) {
                            content.clear();
                            masker.clear();
                            window.location.href = "qqappset.aspx?f=videoGuide";
                        }
                    }
                });
            }
        },
        checkCookie: function (loginUserID, type) {
            var name = "SetUpCookie_" + loginUserID + "_" + type;
            if (null != Ucenter.Config.public.cookie(name) && Ucenter.Config.public.cookie(name) != "" && Ucenter.Config.public.cookie(name) == name)
            { }
            else {
                Ucenter.Config.public.cookie(name, name, {
                    path: '/',
                    domain: '.baomihua.com',
                    expires: 1
                });
                if (type == "1") {//玉米
                    Ucenter.Config.public.setup5();
                }
                else {
                    Ucenter.Config.public.setup4(); //花红
                }
            }
        },
        cookie: function (name, value, options) {
            if (typeof (value) != 'undefined') {
                options = options || {};
                if (value === null) {
                    value = '';
                    options.expires = -1;
                }
                var expires = '';
                if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
                    var date;
                    if (typeof options.expires == 'number') {
                        date = new Date();
                        date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
                    } else {
                        date = options.expires;
                    }
                    expires = '; expires=' + date.toUTCString();
                }
                var path = options.path ? '; path=' + options.path : '';
                var domain = options.domain ? '; domain=' + options.domain : '';
                var secure = options.secure ? '; secure' : '';
                document.cookie = [name, '=', value, expires, path, domain, secure].join('');
            } else {
                var cookieValue = null;
                if (document.cookie && document.cookie != '') {
                    var cookies = document.cookie.split(';');
                    for (var i = 0; i < cookies.length; i++) {
                        var cookie = jQuery.trim(cookies[i]);
                        if (cookie.substring(0, name.length + 1) == (name + '=')) {
                            cookieValue = unescape(cookie.substring(name.length + 1));
                            break;
                        }
                    }
                }
                return cookieValue;
            }
        },
        scrollLoad: function (callback, obj) {
            if (typeof this.dataType === 'undefined' && !this.dataType) { this.dataType = 'videoData'; }
            switch (obj.page) {
                case 'bIndex':
                    var curPage = parseInt($("#PageIndex").val());
                    if (curPage < 10) {
                        //ViewMessage($("#messageType").val(), pageIndex - 1);
                        var channelId = $("#hidChannelID").val();
                        var columnId = $("#hidColumnID").val();
                        var mesType = $("#messageType").val();
                        if (mesType == "SearchData") {
                            var data = "";
                            SearchVideoByKeyWord(curPage + 1);
                        }
                        else {
                            var data = GetVideoList(channelId, columnId, mesType, curPage + 1);
                        }
                        $("#PageIndex").val(curPage + 1);
                        Ucenter.init();

                    }
                    var option = { 'maxPage': curPage }
                    if (parseInt(data) === -1) { option.EOF = true; }
                    break;
                case 'bTinyblog':
                    var curPage = parseInt($("#PageIndex").val());
                    var userID = $("#hidUserID").val();
                    var hidTopicID = parseInt($("#hidTopicID").val());
                    if (curPage >= 1 && curPage <= 10) {
                        var data = ShowWeiboList(curPage, userID, hidTopicID);
                        curPage = parseInt($("#PageIndex").val());
                        $("#PageIndex").val(curPage + 1);
                    }
                    var option = { 'maxPage': curPage }
                    break;
                case 'bBlog':
                    var curPage = parseInt($("#PageIndex").val());
                    if (curPage < 10) {
                        //ViewMessage($("#messageType").val(), pageIndex - 1);
                        var channelId = $("#hidChannelID").val();
                        var data = GetBlogList(channelId, curPage + 1);

                        $("#PageIndex").val(curPage + 1);
                        Ucenter.init();

                    }
                    var option = { 'maxPage': curPage }
                    if (parseInt(data) === -1) { option.EOF = true; }
                    break;
                case 'bUserPage':
                    var curPage = parseInt($("#pageIndex").val()) + parseInt("1");
                    var userID = $("#userID").val();
                    var visitUserID = $("#hidVisitUserID").val();
                    var pageNum = $("#pageNum").val();
                    if (curPage >= 1 && curPage <= 10 && curPage <= pageNum) {
                        var data = ShowUserNewsList(userID, visitUserID, curPage);
                        $("#pageIndex").val(curPage);
                        //$("#newsCount").html($("#newsCount").html() + content);
                    }
                    var option = { 'maxPage': curPage }
                    break;
                case 'bImage':
                    var curPage = parseInt($("#PageIndex").val());
                    if (curPage < 10) {
                        var channelId = $("#hidChannelID").val();
                        var data = GetImgList(channelId, curPage + 1);

                        $("#PageIndex").val(curPage + 1);
                        Ucenter.init();

                    }
                    var option = { 'maxPage': curPage }
                    if (parseInt(data) === -1) { option.EOF = true; }
                    break;
                case 'bFriends':
                    var curPage = parseInt($("#PageIndex").val());
                    if (curPage < 10) {
                        var data = GetFriendsNews(curPage + 1);
                        $("#PageIndex").val(curPage + 1);
                        Ucenter.init();
                    }
                    var option = { 'maxPage': curPage }
                    if (parseInt(data) === -1) { option.EOF = true; }
                    break;
            }
            callback(data, option); //回调函数  
        },
        searchInstant: function (obj) {
            switch (obj.page) {
                case 'bIndex':
                    SearchData();
                    break;
            }
        },
        simulateSelect: function (callback, obj) {
            var type = obj.type
            var channelId = $("#hidChannelID").val();
            var columnId = $("#hidColumnID").val();
            $("#messageType").val(type)
            var data = GetVideoList(channelId, columnId, type, 1);
            $("#PageIndex").val(1);
            $('.p-scrollLoad').html(data);
            Ucenter.init();
            this.dataType = 'videoData';
            callback(data);
        }
    },
    bIndex: {
        usersList: { 'userRows': 2, 'rowMaxLength': 7 }, //点击后显示行数
        scrollLoad: { preLoadDis: 200 }
    }
}